import java.io.*;

public class demo6 {
    public static void main(String[] args) throws IOException {
        //读取文件
        FileInputStream fileInputStream = new FileInputStream("test.txt");
        while (true) {
            int result = fileInputStream.read();
            if (result == -1) {
                //读完了 跳出循环
                break;
            }
            System.out.printf("%c", result);
        }
        //关闭文件----避免占用文件描述符表
        fileInputStream.close();
        FileOutputStream fileOutputStream = new FileOutputStream("test.txt");


    }


}
